#ifndef LIST_H_INCLUDED
#define LIST_H_INCLUDED

#include <stdlib.h>

#define INSERT_NODE(node,pos) do{ \
    node->next = pos;            \
    pos->previous = node;        \
    pos = node;                  \
}while(0)

#define REMOVE_NODE(node,type) do{              \
    if(node->previous != NULL)                \
        node->previous->next = node->next;    \
    if(node->next != NULL)                    \
        node->next->previous = node->previous;\
    free_##type(node);                        \
    free(node);                               \
}while(0)

#endif // LIST_H_INCLUDED

